package com.yitiao.data_algorithms.leetcode.editor.cn;

import java.util.Arrays;

class MinimizeMaximumPairSumInArray {
    // 2023-04-25 17:17:06
    public static void main(String[] args) {
        Solution solution = new MinimizeMaximumPairSumInArray().new Solution();
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public int minPairSum(int[] nums) {
            int res = Integer.MIN_VALUE;
            Arrays.sort(nums);
            int l = 0;
            int r = nums.length - 1;
            while (l < r) {
                if (nums[l] + nums[r] > res) {
                    res = nums[l] + nums[r];
                }
                l++;
                r--;
            }
            return res;
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}